﻿using Fungus;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Forest : MonoBehaviour
{
    GameObject skill;
    Flowchart fungus;
    GameObject data;
    int dialogueValue;
    // Start is called before the first frame update
    void Start()
    {
        data = GameObject.FindGameObjectWithTag("Data");
        skill = GameObject.FindGameObjectWithTag("Skill");
        fungus = skill.GetComponent<Flowchart>();
        
    }

    //泰坦
    private void OnMouseDown()
    {
        dialogueValue = data.GetComponent<GameData>().dialogueValue;
        print(dialogueValue);
        switch (dialogueValue)
        {
            case 3:
                fungus.ExecuteBlock("SummaryEvent3");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 4:
                fungus.ExecuteBlock("SummaryEvent4");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 7:
                fungus.ExecuteBlock("Linear7");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 8:
                fungus.ExecuteBlock("Linear8");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 11:
                fungus.ExecuteBlock("Queue11");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 13:
                fungus.ExecuteBlock("Queue13");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 14:
                fungus.ExecuteBlock("Queue14");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 17:
                fungus.ExecuteBlock("Strand17");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 19:
                fungus.ExecuteBlock("Strand19");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 20:
                fungus.ExecuteBlock("Strand20");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 23:
                fungus.ExecuteBlock("Array23");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 24:
                fungus.ExecuteBlock("Array24");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 25:
                fungus.ExecuteBlock("Array25");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 28:
                fungus.ExecuteBlock("Tree28");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 29:
                fungus.ExecuteBlock("Tree29");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 32:
                fungus.ExecuteBlock("Chart32");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 33:
                fungus.ExecuteBlock("Chart33");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 37:
                fungus.ExecuteBlock("Forest"); break;
        }
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
